package design.Mediator;

/**
 * Created by looper on 2017/8/28.
 */
public class ConcreteMediator extends Mediator {
  protected ResearchDepartment researchDepartment;
  protected ProductDepartment productDepartment;

  public ResearchDepartment getResearchDepartment() {
    return researchDepartment;
  }

  public void setResearchDepartment(ResearchDepartment researchDepartment) {
    this.researchDepartment = researchDepartment;
  }

  public ProductDepartment getProductDepartment() {
    return productDepartment;
  }

  public void setProductDepartment(ProductDepartment productDepartment) {
    this.productDepartment = productDepartment;
  }

  @Override
  public void contact(Department department, String message) {
    if ("研发部".equals(department.getName())) {
      productDepartment.getMessage(message);
    } else if ("产品部".equals(department.getName())) {
      researchDepartment.getMessage(message);
    }
  }
}
